<template>
  <div class="app-box">
    <h1>根组件</h1>

    <!-- 路由链接 -->
    <router-link to="/home">首页</router-link>
    <router-link to="/about">关于</router-link>
    <router-link to="/Wx">我的</router-link>

    <hr>

    <!-- 路由视图 + 入场动画 -->
    <transition name="fade-slide" mode="out-in">
      <router-view />
    </transition>
  </div>
</template>

<script setup></script>

<style scoped>
.app-box {
  text-align: center;
  font-size: 20px;
}
.app-box a {
  padding: 20px;
  color: #000;
  text-decoration: none;
  font-weight: bold;
}
.app-box a.router-link-active {
  color: purple;
}
/* 进场前 */
.fade-slide-enter-from {
  opacity: 0;
  transform: translateY(-50px);
}
/* 进场过渡曲线 */
.fade-slide-enter-active {
  transition: all 1s ease-out;
}
/* 进场后（默认状态） */
.fade-slide-enter-to {
  opacity: 1;
  transform: translateY(0);
}
.fade-slide-leave-active {
  transition: all 0.2s ease-in;
}
.fade-slide-leave-to {
  opacity: 0;
  transform: translateY(50px);
}
</style>